package com.smartwebx.ha.web.admin.module.screen.userConfig;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.smartwebx.ha.biz.assign.HaUserManager;
import com.smartwebx.ha.dal.assign.bean.HaUser;
import com.smartwebx.ha.web.admin.common.HaUserSys;

public class AjaxGetUser {
	@Autowired
	private HaUserManager haUserManager;
	@Autowired
	private HttpServletResponse response;
	@Autowired
	private HttpSession session;

	public void execute() throws Exception {
		response.setContentType("application/json");
		PrintWriter out = response.getWriter();
		ObjectMapper mapper = new ObjectMapper();

		HaUserSys userSys = (HaUserSys) session.getAttribute("haUser");
		HaUser user = haUserManager.findById(userSys.getUserId());
		// 用户密码值空
		user.setPass("");
		mapper.writeValue(out, user);
	}

}